* Keeping the Team Together: How Intra-Party Divisions Shape Party Behavior Across Issues
* Felix Lehmann
* Department of Political Science, University of Gothenburg
* felix.lehmann@gu.se; Sprängkullsgatan 19, Box 711, 411 23 Göteborg, Sweden

* Replication file for the main analysis


* save all replication files in the same folder structure
* change the working directory to the designated folder structure
cd "C:\..."

* the data from the Comparative Candidate Survey (CCS) must be requested individually due to its sensitivity
* to request the data follow these instructions:
* create an account on SWISSUbase: https://www.swissubase.ch/en/account/login
* for the datasets go to: https://www.swissubase.ch/en/catalogue/studies/11249/20486/datasets
* open the links to all three CCS modules 
* select "start download" on each
* accept the download contract
* detail the usage information
* download the contract
* you should receive a reply within a few days
* once granted access to the data, you can continue with the full replication 
* save the files in the designated folder
* the file names should be "CCS wave 1" "CCS wave 2" "CCS wave 3"
* now open the do-files "CCS data creation_ches.do" and "CCS data creation_cmp.do" 
* execute the following do-files (remove the *)

do "CCS data creation_ches.do"
do "CCS data creation_cmp.do"

* load dataset 
use "Keeping the team together_data.dta", replace

// merge the data

merge 1:1 ches_year party_id using "CCS_1_manipulated.dta", keepusing(multicult_divisions_ccs1 imm_eco_divisions_ccs1 environment_divisions_ccs1 eu_divisions_ccs1 economy_divisions_ccs1 lr_divisions_ccs1 ssm_divisions_ccs1 abortion_divisions_ccs1 order_divisions_ccs1 galtan_divisions_ccs1 ecoint_divisions_ccs1 redist_divisions_ccs1) gen(ccs1)

drop if ccs1 == 2

merge 1:1 ches_year party_id using "CCS_2_manipulated.dta", keepusing(multicult_divisions_ccs2 imm_eco_divisions_ccs2 environment_divisions_ccs2 eu_divisions_ccs2 economy_divisions_ccs2 lr_divisions_ccs2 ssm_divisions_ccs2 abortion_divisions_ccs2 order_divisions_ccs2 galtan_divisions_ccs2 ecoint_divisions_ccs2 redist_divisions_ccs2) gen(ccs2)

drop if ccs2 == 2

merge 1:1 ches_year party_id using "CCS_3_manipulated.dta", keepusing(multicult_divisions_ccs3 imm_eco_divisions_ccs3 environment_divisions_ccs3 eu_divisions_ccs3 economy_divisions_ccs3 lr_divisions_ccs3 ssm_divisions_ccs3 abortion_divisions_ccs3 order_divisions_ccs3 galtan_divisions_ccs3 ecoint_divisions_ccs3 redist_divisions_ccs3) gen(ccs3)

drop if ccs3 == 2

* create a single variable with the data from all three waves

gen multicult_divisions_ccs = .
replace multicult_divisions_ccs = multicult_divisions_ccs1 if multicult_divisions_ccs == .
replace multicult_divisions_ccs = multicult_divisions_ccs2 if multicult_divisions_ccs == .
replace multicult_divisions_ccs = multicult_divisions_ccs3 if multicult_divisions_ccs == .

gen imm_eco_divisions_ccs = .
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs1 if imm_eco_divisions_ccs == .
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs2 if imm_eco_divisions_ccs == .
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs3 if imm_eco_divisions_ccs == .

gen environment_divisions_ccs = .
replace environment_divisions_ccs = environment_divisions_ccs1 if environment_divisions_ccs == .
replace environment_divisions_ccs = environment_divisions_ccs2 if environment_divisions_ccs == .
replace environment_divisions_ccs = environment_divisions_ccs3 if environment_divisions_ccs == .

gen eu_divisions_ccs = .
replace eu_divisions_ccs = eu_divisions_ccs1 if eu_divisions_ccs == .
replace eu_divisions_ccs = eu_divisions_ccs2 if eu_divisions_ccs == .
replace eu_divisions_ccs = eu_divisions_ccs3 if eu_divisions_ccs == .

gen economy_divisions_ccs = .
replace economy_divisions_ccs = economy_divisions_ccs1 if economy_divisions_ccs == .
replace economy_divisions_ccs = economy_divisions_ccs2 if economy_divisions_ccs == .
replace economy_divisions_ccs = economy_divisions_ccs3 if economy_divisions_ccs == .

gen lr_divisions_ccs = .
replace lr_divisions_ccs = lr_divisions_ccs1 if lr_divisions_ccs == .
replace lr_divisions_ccs = lr_divisions_ccs2 if lr_divisions_ccs == .
replace lr_divisions_ccs = lr_divisions_ccs3 if lr_divisions_ccs == .

gen galtan_divisions_ccs = .
replace galtan_divisions_ccs = galtan_divisions_ccs1 if galtan_divisions_ccs == .
replace galtan_divisions_ccs = galtan_divisions_ccs2 if galtan_divisions_ccs == .
replace galtan_divisions_ccs = galtan_divisions_ccs3 if galtan_divisions_ccs == .

gen ssm_divisions_ccs = .
replace ssm_divisions_ccs = ssm_divisions_ccs1 if ssm_divisions_ccs == .
replace ssm_divisions_ccs = ssm_divisions_ccs2 if ssm_divisions_ccs == .
replace ssm_divisions_ccs = ssm_divisions_ccs3 if ssm_divisions_ccs == .

gen abortion_divisions_ccs = .
replace abortion_divisions_ccs = abortion_divisions_ccs1 if abortion_divisions_ccs == .
replace abortion_divisions_ccs = abortion_divisions_ccs2 if abortion_divisions_ccs == .
replace abortion_divisions_ccs = abortion_divisions_ccs3 if abortion_divisions_ccs == .

gen order_divisions_ccs = .
replace order_divisions_ccs = order_divisions_ccs1 if order_divisions_ccs == .
replace order_divisions_ccs = order_divisions_ccs2 if order_divisions_ccs == .
replace order_divisions_ccs = order_divisions_ccs3 if order_divisions_ccs == .

gen ecoint_divisions_ccs = .
replace ecoint_divisions_ccs = ecoint_divisions_ccs1 if ecoint_divisions_ccs == .
replace ecoint_divisions_ccs = ecoint_divisions_ccs2 if ecoint_divisions_ccs == .
replace ecoint_divisions_ccs = ecoint_divisions_ccs3 if ecoint_divisions_ccs == .

gen redist_divisions_ccs = .
replace redist_divisions_ccs = redist_divisions_ccs1 if redist_divisions_ccs == .
replace redist_divisions_ccs = redist_divisions_ccs2 if redist_divisions_ccs == .
replace redist_divisions_ccs = redist_divisions_ccs3 if redist_divisions_ccs == .

* rescale to 0-10

replace multicult_divisions_ccs = (multicult_divisions_ccs-.4287465)/(3.121321-.4287465)
replace multicult_divisions_ccs = multicult_divisions_ccs*10

replace imm_eco_divisions_ccs = (imm_eco_divisions_ccs-.7905694)/(3.347833-.7905694)
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs*10

replace eu_divisions_ccs = (eu_divisions_ccs-.3162278)/(3.369201-.3162278)
replace eu_divisions_ccs = eu_divisions_ccs*10

replace economy_divisions_ccs = (economy_divisions_ccs-.8751751)/(2.524786-.8751751)
replace economy_divisions_ccs = economy_divisions_ccs*10

replace lr_divisions_ccs = (lr_divisions_ccs-.6030227)/(2.968266-.6030227)
replace lr_divisions_ccs = lr_divisions_ccs*10

replace galtan_divisions_ccs = (galtan_divisions_ccs-.5337605)/(2.352213-.5337605)
replace galtan_divisions_ccs = galtan_divisions_ccs*10

replace ssm_divisions_ccs = (ssm_divisions_ccs-0)/(4.322189-0)
replace ssm_divisions_ccs = ssm_divisions_ccs*10

replace abortion_divisions_ccs = (abortion_divisions_ccs-0)/(3.758324-0)
replace abortion_divisions_ccs = abortion_divisions_ccs*10

replace order_divisions_ccs = (order_divisions_ccs-1.046247)/(3.421191-1.046247)
replace order_divisions_ccs = order_divisions_ccs*10

replace ecoint_divisions_ccs = (ecoint_divisions_ccs-1.134626)/(3.572352-1.134626)
replace ecoint_divisions_ccs = ecoint_divisions_ccs*10

replace redist_divisions_ccs = (redist_divisions_ccs-.6687505)/(3.964288-.6687505)
replace redist_divisions_ccs = redist_divisions_ccs*10

replace environment_divisions_ccs = (environment_divisions_ccs-0)/(3.170253-0)
replace environment_divisions_ccs = environment_divisions_ccs*10

gen eu_divisions_ccs_sq = eu_divisions_ccs*eu_divisions_ccs
gen multicult_divisions_ccs_sq = multicult_divisions_ccs*multicult_divisions_ccs
gen environment_divisions_ccs_sq = environment_divisions_ccs*environment_divisions_ccs
gen redist_divisions_ccs_sq = redist_divisions_ccs*redist_divisions_ccs
gen order_divisions_ccs_sq = order_divisions_ccs*order_divisions_ccs
gen ssm_divisions_ccs_sq = ssm_divisions_ccs*ssm_divisions_ccs

label variable eu_divisions_ccs "EU divisions"
label variable imm_eco_divisions_ccs "Immigration (econ) divisions"
label variable multicult_divisions_ccs "Multiculturalism divisions"
label variable economy_divisions_ccs "Economy divisions"
label variable environment_divisions_ccs "Environment divisions"
label variable lr_divisions_ccs "Left-right divisions"
label variable galtan_divisions_ccs "GAL-TAN divisions"
label variable ssm_divisions_ccs "Same-sex marriage divisions"
label variable abortion_divisions_ccs "Abortion divisions"
label variable order_divisions_ccs "Civil liberties divisions"
label variable ecoint_divisions_ccs "Economic intervention divisions"
label variable redist_divisions_ccs "Redistribution divisions"

label variable eu_divisions_ccs_sq "EU divisions squared"
label variable multicult_divisions_ccs_sq "Multiculturalism divisions squared"
label variable environment_divisions_ccs_sq "Environment divisions squared"
label variable ssm_divisions_ccs_sq "Same-sex marriage divisions squared"
label variable order_divisions_ccs_sq "Civil liberties divisions squared"
label variable redist_divisions_ccs_sq "Redistribution divisions squared"
* save the new dataset
save "Keeping the team together_data2.dta", replace



* next open the stacked dataset
use "Keeping the team together_data_stacked.dta", clear

merge m:1 ches_year party_id using "CCS_1_manipulated.dta", keepusing(multicult_divisions_ccs1 imm_eco_divisions_ccs1 environment_divisions_ccs1 eu_divisions_ccs1 economy_divisions_ccs1 lr_divisions_ccs1 ssm_divisions_ccs1 abortion_divisions_ccs1 order_divisions_ccs1 galtan_divisions_ccs1 ecoint_divisions_ccs1 redist_divisions_ccs1) gen(ccs1)

drop if ccs1 == 2

merge m:1 ches_year party_id using "CCS_2_manipulated.dta", keepusing(multicult_divisions_ccs2 imm_eco_divisions_ccs2 environment_divisions_ccs2 eu_divisions_ccs2 economy_divisions_ccs2 lr_divisions_ccs2 ssm_divisions_ccs2 abortion_divisions_ccs2 order_divisions_ccs2 galtan_divisions_ccs2 ecoint_divisions_ccs2 redist_divisions_ccs2) gen(ccs2)

drop if ccs2 == 2

merge m:1 ches_year party_id using "CCS_3_manipulated.dta", keepusing(multicult_divisions_ccs3 imm_eco_divisions_ccs3 environment_divisions_ccs3 eu_divisions_ccs3 economy_divisions_ccs3 lr_divisions_ccs3 ssm_divisions_ccs3 abortion_divisions_ccs3 order_divisions_ccs3 galtan_divisions_ccs3 ecoint_divisions_ccs3 redist_divisions_ccs3) gen(ccs3)

drop if ccs3 == 2
// join the two waves

gen multicult_divisions_ccs = .
replace multicult_divisions_ccs = multicult_divisions_ccs1 if multicult_divisions_ccs == .
replace multicult_divisions_ccs = multicult_divisions_ccs2 if multicult_divisions_ccs == .
replace multicult_divisions_ccs = multicult_divisions_ccs3 if multicult_divisions_ccs == .

gen imm_eco_divisions_ccs = .
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs1 if imm_eco_divisions_ccs == .
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs2 if imm_eco_divisions_ccs == .
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs3 if imm_eco_divisions_ccs == .

gen environment_divisions_ccs = .
replace environment_divisions_ccs = environment_divisions_ccs1 if environment_divisions_ccs == .
replace environment_divisions_ccs = environment_divisions_ccs2 if environment_divisions_ccs == .
replace environment_divisions_ccs = environment_divisions_ccs3 if environment_divisions_ccs == .

gen eu_divisions_ccs = .
replace eu_divisions_ccs = eu_divisions_ccs1 if eu_divisions_ccs == .
replace eu_divisions_ccs = eu_divisions_ccs2 if eu_divisions_ccs == .
replace eu_divisions_ccs = eu_divisions_ccs3 if eu_divisions_ccs == .

gen economy_divisions_ccs = .
replace economy_divisions_ccs = economy_divisions_ccs1 if economy_divisions_ccs == .
replace economy_divisions_ccs = economy_divisions_ccs2 if economy_divisions_ccs == .
replace economy_divisions_ccs = economy_divisions_ccs3 if economy_divisions_ccs == .

gen lr_divisions_ccs = .
replace lr_divisions_ccs = lr_divisions_ccs1 if lr_divisions_ccs == .
replace lr_divisions_ccs = lr_divisions_ccs2 if lr_divisions_ccs == .
replace lr_divisions_ccs = lr_divisions_ccs3 if lr_divisions_ccs == .

gen galtan_divisions_ccs = .
replace galtan_divisions_ccs = galtan_divisions_ccs1 if galtan_divisions_ccs == .
replace galtan_divisions_ccs = galtan_divisions_ccs2 if galtan_divisions_ccs == .
replace galtan_divisions_ccs = galtan_divisions_ccs3 if galtan_divisions_ccs == .

gen ssm_divisions_ccs = .
replace ssm_divisions_ccs = ssm_divisions_ccs1 if ssm_divisions_ccs == .
replace ssm_divisions_ccs = ssm_divisions_ccs2 if ssm_divisions_ccs == .
replace ssm_divisions_ccs = ssm_divisions_ccs3 if ssm_divisions_ccs == .

gen abortion_divisions_ccs = .
replace abortion_divisions_ccs = abortion_divisions_ccs1 if abortion_divisions_ccs == .
replace abortion_divisions_ccs = abortion_divisions_ccs2 if abortion_divisions_ccs == .
replace abortion_divisions_ccs = abortion_divisions_ccs3 if abortion_divisions_ccs == .

gen order_divisions_ccs = .
replace order_divisions_ccs = order_divisions_ccs1 if order_divisions_ccs == .
replace order_divisions_ccs = order_divisions_ccs2 if order_divisions_ccs == .
replace order_divisions_ccs = order_divisions_ccs3 if order_divisions_ccs == .

gen ecoint_divisions_ccs = .
replace ecoint_divisions_ccs = ecoint_divisions_ccs1 if ecoint_divisions_ccs == .
replace ecoint_divisions_ccs = ecoint_divisions_ccs2 if ecoint_divisions_ccs == .
replace ecoint_divisions_ccs = ecoint_divisions_ccs3 if ecoint_divisions_ccs == .

gen redist_divisions_ccs = .
replace redist_divisions_ccs = redist_divisions_ccs1 if redist_divisions_ccs == .
replace redist_divisions_ccs = redist_divisions_ccs2 if redist_divisions_ccs == .
replace redist_divisions_ccs = redist_divisions_ccs3 if redist_divisions_ccs == .


* rescale to 0-10

replace multicult_divisions_ccs = (multicult_divisions_ccs-.4287465)/(3.121321-.4287465)
replace multicult_divisions_ccs = multicult_divisions_ccs*10

replace imm_eco_divisions_ccs = (imm_eco_divisions_ccs-.7905694)/(3.347833-.7905694)
replace imm_eco_divisions_ccs = imm_eco_divisions_ccs*10

replace eu_divisions_ccs = (eu_divisions_ccs-.3162278)/(3.369201-.3162278)
replace eu_divisions_ccs = eu_divisions_ccs*10

replace economy_divisions_ccs = (economy_divisions_ccs-.8751751)/(2.524786-.8751751)
replace economy_divisions_ccs = economy_divisions_ccs*10

replace lr_divisions_ccs = (lr_divisions_ccs-.6030227)/(2.968266-.6030227)
replace lr_divisions_ccs = lr_divisions_ccs*10

replace galtan_divisions_ccs = (galtan_divisions_ccs-.5337605)/(2.352213-.5337605)
replace galtan_divisions_ccs = galtan_divisions_ccs*10

replace ssm_divisions_ccs = (ssm_divisions_ccs-0)/(4.322189-0)
replace ssm_divisions_ccs = ssm_divisions_ccs*10

replace abortion_divisions_ccs = (abortion_divisions_ccs-0)/(3.758324-0)
replace abortion_divisions_ccs = abortion_divisions_ccs*10

replace order_divisions_ccs = (order_divisions_ccs-1.046247)/(3.421191-1.046247)
replace order_divisions_ccs = order_divisions_ccs*10

replace ecoint_divisions_ccs = (ecoint_divisions_ccs-1.134626)/(3.572352-1.134626)
replace ecoint_divisions_ccs = ecoint_divisions_ccs*10

replace redist_divisions_ccs = (redist_divisions_ccs-.6687505)/(3.964288-.6687505)
replace redist_divisions_ccs = redist_divisions_ccs*10

replace environment_divisions_ccs = (environment_divisions_ccs-0)/(3.170253-0)
replace environment_divisions_ccs = environment_divisions_ccs*10

gen issue_divisions2 = .
gen issue_divisions3 = .
// issues
replace issue_divisions2 = eu_divisions_ccs if issue == 2
replace issue_divisions2 = multicult_divisions_ccs if issue == 4
replace issue_divisions2 = environment_divisions_ccs if issue == 6
replace issue_divisions2 = redist_divisions_ccs if issue == 7
replace issue_divisions2 = order_divisions_ccs if issue == 8
replace issue_divisions2 = ssm_divisions_ccs if issue == 9

// used only for blurring
replace issue_divisions3 = eu_divisions_ccs if issue == 2
replace issue_divisions3 = economy_divisions_ccs if issue == 11

gen issue_divisions_lag2 = issue_divisions2 if election_timing > 0

gen issue_divisions2_s = (issue_divisions2-5.719589)/1.842843
gen issue_divisions_lag2s = (issue_divisions_lag2-5.86368)/1.899152

label variable issue_divisions2_s "Divisions CCS"
label variable issue_divisions_lag2s "Divisions CCS (t-1)"
label variable issue_divisions2 "Divisions CCS"
label variable issue_divisions3 "Divisions CCS"
label variable issue_divisions_lag2 "Divisions CCS (t-1)"


save "Keeping the team together_data_stacked2.dta", replace

*/

* load the stacked dataset for the descriptives in Figure 1
use "Keeping the team together_data_stacked2.dta", clear


* Figure 1
set scheme plotplain

graph hbar (mean) issue_divisions1 if issue_divisions1 != ., over(family_simple, sort(issue_divisions1) descending) by(issue, note("") title("(A) CHES divisions indicator", margin(b=1) size(med))) note("") ytitle("") blabel(bar, format(%4.1f)) bar(1, color(dknavy))

graph export "fig1a.png", replace

graph hbar (mean) issue_divisions2 if issue_divisions2 != . , over(family_simple, sort(issue_divisions2) descending) by(issue, note("") title("(B) CCS divisions indicator", margin(b=1) size(med))) note("") ytitle("") blabel(bar, format(%4.1f))  bar(1, color(dknavy))

graph export "fig1b.png", replace

* load the non-stacked dataset for the bivariate scatterplots in Figure 2-4
* Figure 2

use "Keeping the team together_data2.dta", clear

* retrieve p-values and correlation coefficients
pwcorr eu_salience eu_dissent, sig star(0.001) obs
pwcorr immigrate_salience immigrate_dissent, sig star(0.001) obs
pwcorr multicult_salience multicult_dissent, sig star(0.001) obs
pwcorr lrecon_salience lrecon_dissent, sig star(0.001) obs

* create the graphs
set scheme s1mono
sc eu_salience eu_dissent, msymbol(Oh) || lfit eu_salience eu_dissent, title("{bf:EU}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 8) legend(off) ytitle(EU salience) lpattern(solid) lwidth(thick) note(r = -0.16***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g1, replace
sc immigrate_salience immigrate_dissent, msymbol(Oh) || lfit immigrate_salience immigrate_dissent, title("{bf:Immigration}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 8) legend(off) ytitle(Immigration salience) lpattern(solid) lwidth(thick) note(r = -0.44***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g2, replace
sc multicult_salience multicult_dissent, msymbol(Oh) || lfit multicult_salience multicult_dissent, title("{bf:Multiculturalism}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 8) legend(off) ytitle(Multiculturalism salience) lpattern(solid) lwidth(thick) note(r = -0.36***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g3, replace
sc lrecon_salience lrecon_dissent, msymbol(Oh) || lfit lrecon_salience lrecon_dissent, title("{bf:Economy}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 8) legend(off) ytitle(Economy salience) lpattern(solid) lwidth(thick) note(r = -0.09*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g4, replace

graph combine "g1" "g2" "g3" "g4", title("(A) CHES divisions indicator", size(medium)) caption("+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall))

graph export "fig2a.png", replace

pwcorr eu_salience eu_divisions_ccs, sig star(0.001) obs
pwcorr multicult_salience multicult_divisions_ccs, sig star(0.001) obs
pwcorr enviro_salience environment_divisions_ccs, sig star(0.001) obs
pwcorr redist_salience redist_divisions_ccs, sig star(0.001) obs
pwcorr civlib_salience order_divisions_ccs, sig star(0.001) obs
pwcorr social_salience ssm_divisions_ccs, sig star(0.001) ob

set scheme s1mono
sc eu_salience eu_divisions_ccs, msymbol(Oh) || lfit eu_salience eu_divisions_ccs, title("{bf:EU}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10) xlabel(0 (2) 10) legend(off) ytitle(EU salience) lpattern(solid) lwidth(thick) note(r = -0.25***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g1, replace
sc multicult_salience multicult_divisions_ccs, msymbol(Oh) || lfit multicult_salience multicult_divisions_ccs, title("{bf:Multiculturalism}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10) xlabel(0 (2) 10) legend(off) ytitle(Multiculturalism salience) lpattern(solid) lwidth(thick) note(r = -0.19*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g2, replace
sc enviro_salience environment_divisions_ccs, msymbol(Oh) || lfit enviro_salience environment_divisions_ccs, title("{bf:Environment}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 10) legend(off) ytitle(Environment salience) lpattern(solid) lwidth(thick) note(r = -0.38***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g3, replace
sc redist_salience redist_divisions_ccs, msymbol(Oh) || lfit redist_salience redist_divisions_ccs, title("{bf:Redistribution}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 10) legend(off) ytitle(Redistribution salience) lpattern(solid) lwidth(thick) note(r = -0.59***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g4, replace
sc civlib_salience order_divisions_ccs, msymbol(Oh) || lfit civlib_salience order_divisions_ccs, title("{bf:Civil liberties}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10)  xlabel(0 (2) 10) legend(off) ytitle(Civil liberties salience) lpattern(solid) lwidth(thick) note(r = -0.03, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g5, replace
sc social_salience ssm_divisions_ccs, msymbol(Oh) || lfit social_salience ssm_divisions_ccs, title("{bf:Social lifestyle}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (2) 10) xlabel(0 (2) 10) legend(off) ytitle(Social lifestyle salience) lpattern(solid) lwidth(thick) note(r = -0.37*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g6, replace

graph combine "g1" "g2" "g3" "g4" "g5" "g6", title("(B) CCS divisions indicator", size(medium)) caption("+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall))

graph export "fig2b.png", replace

* Figure 3
use "Keeping the team together_data2.dta", clear

pwcorr eu_position_change_abs eu_dissent, sig star(0.001) obs
pwcorr immigration_position_change_abs immigrate_dissent, sig star(0.001) obs
pwcorr multicult_position_change_abs multicult_dissent, sig star(0.001) obs
pwcorr lrecon_position_change_abs lrecon_dissent, sig star(0.001) obs

set scheme s1mono
sc eu_position_change_abs eu_dissent, msymbol(Oh) || lfit eu_position_change_abs eu_dissent, title("{bf:EU}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Δ EU position) lpattern(solid) lwidth(thick) note(r = 0.19***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g1, replace
sc immigration_position_change_abs immigrate_dissent, msymbol(Oh) || lfit immigration_position_change_abs immigrate_dissent, title("{bf:Immigration}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Δ Immigration position) lpattern(solid) lwidth(thick) note(r = 0.19***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g2, replace
sc multicult_position_change_abs multicult_dissent, msymbol(Oh) || lfit multicult_position_change_abs multicult_dissent, title("{bf:Multiculturalism}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Δ Multiculturalism position) lpattern(solid) lwidth(thick) note(r = 0.04, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g3, replace
sc lrecon_position_change_abs lrecon_dissent, msymbol(Oh) || lfit lrecon_position_change_abs lrecon_dissent, title("{bf:Economy}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Δ Economy position) lpattern(solid) lwidth(thick) note(r = 0.12*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g4, replace

graph combine "g1" "g2" "g3" "g4", title("(A) CHES divisions indicator", size(medium)) caption("+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall))

graph export "fig3a.png", replace

pwcorr eu_position_change_abs eu_divisions_ccs, sig star(0.001) obs
pwcorr multicult_position_change_abs multicult_divisions_ccs, sig star(0.001) obs
pwcorr environment_position_change_abs environment_divisions_ccs, sig star(0.001) obs
pwcorr redist_position_change_abs redist_divisions_ccs, sig star(0.001) obs
pwcorr civlib_position_change_abs order_divisions_ccs, sig star(0.001) obs
pwcorr social_position_change_abs ssm_divisions_ccs, sig star(0.001) obs

set scheme s1mono
sc eu_position_change_abs eu_divisions_ccs, msymbol(Oh) || lfit eu_position_change_abs eu_divisions_ccs, title("{bf:EU}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5) xlabel(0 (2) 10) legend(off) ytitle(Δ EU position) lpattern(solid) lwidth(thick) note(r = 0.14*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g1, replace
sc multicult_position_change_abs multicult_divisions_ccs, msymbol(Oh) || lfit multicult_position_change_abs multicult_divisions_ccs, title("{bf:Multiculturalism}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5) xlabel(0 (2) 10) legend(off) ytitle(Δ Multiculturalism position) lpattern(solid) lwidth(thick) note(r = 0.04, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g2, replace
sc environment_position_change_abs environment_divisions_ccs, msymbol(Oh) || lfit environment_position_change_abs environment_divisions_ccs, title("{bf:Environment}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 10) legend(off) ytitle(Δ Environment position) lpattern(solid) lwidth(thick) note(r = -0.04, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g3, replace
sc redist_position_change_abs redist_divisions_ccs, msymbol(Oh) || lfit redist_position_change_abs redist_divisions_ccs, title("{bf:Redistribution}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 10) legend(off) ytitle(Δ Redistribution position) lpattern(solid) lwidth(thick) note(r = 0.19*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g4, replace
sc civlib_position_change_abs order_divisions_ccs, msymbol(Oh) || lfit civlib_position_change_abs order_divisions_ccs, title("{bf:Civil liberties}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 10) legend(off) ytitle(Δ Civil liberties position) lpattern(solid) lwidth(thick) note(r = 0.05, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g5, replace
sc social_position_change_abs ssm_divisions_ccs, msymbol(Oh) || lfit social_position_change_abs ssm_divisions_ccs, title("{bf:Social lifestyle}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5) xlabel(0 (2) 10) legend(off) ytitle(Δ Social lifestyle position) lpattern(solid) lwidth(thick) note(r = 0.13+, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g6, replace

graph combine "g1" "g2" "g3" "g4" "g5" "g6", title("(B) CCS divisions indicator", size(medium)) caption("+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall))

graph export "fig3b.png", replace

* Figure 4
use "Keeping the team together_data2.dta", clear

pwcorr eu_blur_std eu_dissent, sig star(0.001) obs
pwcorr immigrate_policy_blur_std immigrate_dissent, sig star(0.001) obs
pwcorr multiculturalism_blur_std multicult_dissent, sig star(0.001) obs
pwcorr lrecon_blur_std lrecon_dissent, sig star(0.001) obs

set scheme s1mono
sc eu_blur_std eu_dissent, msymbol(Oh) || lfit eu_blur_std eu_dissent, title("{bf:EU}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(EU blur) lpattern(solid) lwidth(thick) note(r = 0.26***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g1, replace
sc immigrate_policy_blur_std immigrate_dissent, msymbol(Oh) || lfit immigrate_policy_blur_std immigrate_dissent, title("{bf:Immigration}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Immigration blur) lpattern(solid) lwidth(thick) note(r = 0.45***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g2, replace
sc multiculturalism_blur_std multicult_dissent, msymbol(Oh) || lfit multiculturalism_blur_std multicult_dissent, title("{bf:Multiculturalism}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Multiculturalism blur) lpattern(solid) lwidth(thick) note(r = 0.15*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g3, replace
sc lrecon_blur_std lrecon_dissent, msymbol(Oh) || lfit lrecon_blur_std lrecon_dissent, title("{bf:Economy}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 8) legend(off) ytitle(Economy blur) lpattern(solid) lwidth(thick) note(r = 0.02, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g4, replace

graph combine "g1" "g2" "g3" "g4", title("(A) CHES divisions indicator", size(medium)) caption("+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001,", position(5) justification(right) size(vsmall))

graph export "fig4a.png", replace

pwcorr eu_blur_std eu_divisions_ccs, sig star(0.001) obs
pwcorr multiculturalism_blur_std multicult_divisions_ccs, sig star(0.001) obs
pwcorr environment_blur_std environment_divisions_ccs, sig star(0.001) obs
pwcorr redistribution_blur_std redist_divisions_ccs, sig star(0.001) obs
pwcorr civlib_laworder_blur_std order_divisions_ccs, sig star(0.001) obs
pwcorr sociallifestyle_blur_std ssm_divisions_ccs, sig star(0.001) obs

set scheme s1mono
sc eu_blur_std eu_divisions_ccs, msymbol(Oh) || lfit eu_blur_std eu_divisions_ccs, title("{bf:EU}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5) xlabel(0 (2) 10) legend(off) ytitle(EU blur) lpattern(solid) lwidth(thick) note(r = 0.3***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g1, replace
sc multiculturalism_blur_std multicult_divisions_ccs, msymbol(Oh) || lfit multiculturalism_blur_std multicult_divisions_ccs, title("{bf:Multiculturalism}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5) xlabel(0 (2) 10) legend(off) ytitle(Multiculturalism blur) lpattern(solid) lwidth(thick) note(r = 0.12+, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g2, replace
sc environment_blur_std environment_divisions_ccs, msymbol(Oh) || lfit environment_blur_std environment_divisions_ccs, title("{bf:Environment}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 10) legend(off) ytitle(Environment blur) lpattern(solid) lwidth(thick) note(r = -0.15*, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g3, replace
sc redistribution_blur_std redist_divisions_ccs, msymbol(Oh) || lfit redistribution_blur_std redist_divisions_ccs, title("{bf:Redistribution}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 10) legend(off) ytitle(Redistribution blur) lpattern(solid) lwidth(thick) note(r = 0.35***, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g4, replace
sc civlib_laworder_blur_std order_divisions_ccs, msymbol(Oh) || lfit civlib_laworder_blur_std order_divisions_ccs, title("{bf:Civil liberties}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5)  xlabel(0 (2) 10) legend(off) ytitle(Civil liberties blur) lpattern(solid) lwidth(thick) note(r = 0.02, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g5, replace
sc sociallifestyle_blur_std ssm_divisions_ccs, msymbol(Oh) || lfit sociallifestyle_blur_std ssm_divisions_ccs, title("{bf:Social lifestyle}", margin(b=1) size(medlarge)) lwidth(medthick) ylabel(0 (1) 5) xlabel(0 (2) 10) legend(off) ytitle(Social lifestyle blur) lpattern(solid) lwidth(thick) note(r = 0.23**, ring(0) pos(1) size(med)) mcolor(gs0) lcolor(dknavy) msize(small)
graph save g6, replace

graph combine "g1" "g2" "g3" "g4" "g5" "g6", title("(B) CCS divisions indicator", size(medium)) caption("+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall))

graph export "fig4b.png", replace

* Figure 5
use "Keeping the team together_data2.dta", clear
eststo clear

eststo: reg eu_salience eu_dissent vote vote_change government i.election_id
estimate store eu
eststo: reg immigrate_salience immigrate_dissent vote vote_change government i.election_id
estimate store im
eststo: reg multicult_salience multicult_dissent vote vote_change government i.election_id
estimate store mc
eststo: reg lrecon_salience lrecon_dissent vote vote_change government i.election_id
estimate store ec

eststo: reg eu_position_change_abs eu_dissent vote vote_change government i.election_id
estimate store eu2
eststo: reg immigration_position_change_abs immigrate_dissent vote vote_change government i.election_id
estimate store im2
eststo: reg multicult_position_change_abs multicult_dissent vote vote_change government i.election_id
estimate store mc2
eststo: reg lrecon_position_change_abs lrecon_dissent vote vote_change government i.election_id
estimate store ec2

eststo: reg eu_blur_std eu_dissent vote vote_change government i.election_id 
estimate store eu3
eststo: reg immigrate_policy_blur_std immigrate_dissent vote vote_change government i.election_id
estimate store im3
eststo: reg multiculturalism_blur_std multicult_dissent vote vote_change government i.election_id
estimate store mc3
eststo: reg lrecon_blur_std lrecon_dissent vote vote_change government i.election_id
estimate store ec3

set scheme s1mono
coefplot eu mc im ec, bylabel(Salience (H1)) || eu2 mc2 im2 ec2, bylabel(Δ Position (H2)) || eu3 im3 mc3 ec3, bylabel(Blur (H3)) ||, keep(eu_dissent immigrate_dissent multicult_dissent lrecon_dissent) legend(pos(6) row(1)) byopts(cols(3) xrescale legend(off) title("CHES divisions indicator", size(medium))) levels(90) mlabel(cond(@pval<.001, string(@b, "%9.2fc") + "***", ///
cond(@pval<.01, string(@b, "%9.2fc") + "**" , ///
cond(@pval<.05, string(@b, "%9.2fc") + "*"  , ///
cond(@pval<.1, string(@b, "%9.2fc") + "+", ///
string(@b, "%9.2fc")))))) ///
mlabposition(12) grid(none) msymbol(s) color(blue) ciopts(lcolor(dknavy))
//addplot 1: , xline(0) norescaling legend(off) 
addplot 2: , xline(0) norescaling legend(off)
addplot 3: , xline(0) norescaling legend(off)

graph save "g1", replace

graph combine "g1", caption("90% CIs; + p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall)) 

graph export "fig5a.png", replace

use "Keeping the team together_data2.dta", clear

eststo clear

eststo: qui: reg eu_salience eu_divisions_ccs vote vote_change government i.election_id
estimate store eu
eststo: qui: reg multicult_salience multicult_divisions_ccs vote vote_change government i.election_id
estimate store mc
eststo: qui: reg enviro_salience environment_divisions_ccs vote vote_change government i.election_id
estimate store ev
eststo: qui: reg redist_salience redist_divisions_ccs vote vote_change government i.election_id
estimate store rd
eststo: qui: reg civlib_salience order_divisions_ccs vote vote_change government i.election_id
estimate store cl
eststo: qui: reg social_salience ssm_divisions_ccs vote vote_change government i.election_id
estimate store sl

eststo: qui: reg eu_position_change_abs eu_divisions_ccs vote vote_change government i.election_id
estimate store eu2
eststo: qui: reg multicult_position_change_abs multicult_divisions_ccs vote vote_change government i.election_id
estimate store mc2
eststo: qui: reg environment_position_change_abs environment_divisions_ccs vote vote_change government i.election_id
estimate store ev2
eststo: qui: reg redist_position_change_abs redist_divisions_ccs vote vote_change government i.election_id
estimate store rd2
eststo: qui: reg civlib_position_change_abs order_divisions_ccs vote vote_change government i.election_id
estimate store cl2
eststo: qui: reg social_position_change_abs ssm_divisions_ccs vote vote_change government i.election_id
estimate store sl2

eststo: qui: reg eu_blur_std eu_divisions_ccs vote vote_change government i.election_id
estimate store eu3
eststo: qui: reg multiculturalism_blur_std multicult_divisions_ccs vote vote_change government i.election_id
estimate store mc3
eststo: qui: reg environment_blur_std environment_divisions_ccs vote vote_change government i.election_id
estimate store ev3
eststo: qui: reg redistribution_blur_std redist_divisions_ccs vote vote_change government i.election_id
estimate store rd3
eststo: qui: reg civlib_laworder_blur_std order_divisions_ccs vote vote_change government i.election_id
estimate store cl3
eststo: qui: reg sociallifestyle_blur_std ssm_divisions_ccs vote vote_change government i.election_id
estimate store sl3

set scheme s1mono
coefplot eu mc ev rd cl sl, bylabel(Salience (H1))  || eu2 mc2 ev2 rd2 cl2 sl2, bylabel(Δ Position (H2))  || eu3 mc3 ev3 rd3 cl3 sl3, bylabel(Blur (H3)) ||, xline(0) keep(eu_divisions_ccs multicult_divisions_ccs environment_divisions_ccs redist_divisions_ccs order_divisions_ccs ssm_divisions_ccs economy_divisions_ccs) legend(pos(6) row(1)) byopts(cols(3) xrescale legend(off) title("CCS divisions indicator", size(medium))) levels(90) mlabel(cond(@pval<.001, string(@b, "%9.2fc") + "***", ///
cond(@pval<.01, string(@b, "%9.2fc") + "**" , ///
cond(@pval<.05, string(@b, "%9.2fc") + "*"  , ///
cond(@pval<.1, string(@b, "%9.2fc") + "+", ///
string(@b, "%9.2fc")))))) ///
mlabposition(12) grid(none) msymbol(s) color(blue) ciopts(lcolor(dknavy))
*addplot 1: , xline(0) norescaling legend(off)
*addplot 2: , xline(0) norescaling legend(off)

graph save "g1", replace

graph combine "g1", caption("90% CIs; + p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001", position(5) justification(right) size(vsmall)) 

graph export "fig5b.png", replace

* load the stacked dataset for Table 1
use "Keeping the team together_data_stacked2.dta", clear

eststo clear
// H1
eststo: reghdfe salience issue_divisions1_s vote vote_change government, cluster(party_id) absorb(election_id issue)
estadd local election "Yes"
estadd local issue "Yes"
estadd local cluster "Yes"
eststo: reghdfe salience issue_divisions2_s vote vote_change government, cluster(party_id) absorb(election_id issue)
estadd local election "Yes"
estadd local issue "Yes"
estadd local cluster "Yes"
// H2
eststo: reghdfe abs_position_change issue_divisions1_s vote vote_change government, cluster(party_id) absorb(election_id issue)
estadd local election "Yes"
estadd local issue "Yes"
estadd local cluster "Yes"
eststo: reghdfe abs_position_change issue_divisions2_s vote vote_change government, cluster(party_id) absorb(election_id issue)
estadd local election "Yes"
estadd local issue "Yes"
estadd local cluster "Yes"
// H3
eststo: reghdfe blur issue_divisions1_s vote vote_change government, cluster(party_id) absorb(election_id issue)
estadd local election "Yes"
estadd local issue "Yes"
estadd local cluster "Yes"
eststo: reghdfe blur issue_divisions2_s vote vote_change government, cluster(party_id) absorb(election_id issue) 
estadd local election "Yes"
estadd local issue "Yes"
estadd local cluster "Yes"

esttab using Table1.rtf, replace label varwidth(16) se modelwidth(5) compress nogap onecell stats(N election issue cluster, fmt(a2) label ("Observations" "Election FEs" "Issue FEs" "Clustered SEs")) star (+ 0.1 * 0.05 ** 0.01 *** 0.001) nonumbers mtitles(H1 H1 H2 H2 H3 H3 H4 H4) note("Notes: Pooled multivariate regression models of the relationship between intra-party divisions and salience (H1), position change (H2), and blurring (H3). Models 1, 3, and 5 use the CHES division indicator and models 2, 4, and 6 use the CCS division indicator. The two indicators are standardized. Clustered standard errors in parentheses.") b(%9.3fc) order(issue_divisions1_s issue_divisions2_s vote vote_change government _cons) keep(issue_divisions1_s issue_divisions2_s vote vote_change government _cons)

